/*
 * @Date: 2023-03-12 14:54:06
 * @LastEditors: Zireael 1193875164@qq.com
 * @LastEditTime: 2023-03-12 15:09:25
 * @FilePath: \A19\backend\src\api\Experiment\ApiCourseFromExp.ts
 */
import { ApiCall } from "tsrpc";
import { ReqCourseFromExp, ResCourseFromExp } from "../../shared/protocols/Experiment/PtlCourseFromExp";
import { Global } from '../../Global/index';

export default async function (call: ApiCall<ReqCourseFromExp, ResCourseFromExp>) {
    // TODO
    const exp = await Global.collection('experiments').findOne({
        _id:call.req.experiment
    })
    
    if(!exp) return call.error('不存在')
    // const course = await Global.collection('courses').findOne({
    //     _id:exp.course
    // })

    // if(!course) return call.error('不存在')

    call.succ({
        expInfo:exp
    })
}